/*
package com.luweijie.controller;


import com.google.common.collect.Lists;
import com.luweijie.entity.GoddessUser;
import com.luweijie.entity.po.ShzwActivityPo;
import com.luweijie.mapper.ShzwActivityMapper;
import com.luweijie.repository.EsUserRepository;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

*/
/**
 * Created by liuliang on 2019/4/8.
 *//*

@RestController
@RequestMapping("/api/es")
@Slf4j
public class EsUserController {


    @Autowired
    private ShzwActivityMapper userMapper;

    @Autowired
    EsUserRepository esUserRepository;

    @PostMapping("/insert/all")
    public ResponseEntity loadAllUser() {
        ShzwActivityPo a = userMapper.a(1);
        log.info("users:{}", a);

        esUserRepository.save(a);

        return ResponseEntity.ok(true);
    }


    @GetMapping("/search")
    public ResponseEntity getByName(String name) {

        //按name进行搜索
        MatchQueryBuilder builder = QueryBuilders.matchQuery("goodsType", name);

        //如果实体和数据的名称对应就会自动封装，pageable分页参数
        Iterable<ShzwActivityPo> search = esUserRepository.search(builder);
              search.forEach(m-> System.out.println("m = " + m));
        //迭代器转list

        return ResponseEntity.ok(true);
    }
}*/
